home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cpptutor.arc / LOCATION.HPP < prev    next >
C/C++ Source or Header  |  1991-04-28  |  2KB  |  43 lines

  1. // This is the definition of the 19 different locations it is
  2. //  possible to enter.  This class contains an embedded object of
  3. //  class "items" to store the elements in each location.  The
  4. //  message is output automatically when the location is entered,
  5. //  and the look_message is output when the player gives the look
  6. //  command.
  7.  
  8.  
  9. #ifndef LOCATIONHPP
  10. #define LOCATIONHPP
  11.  
  12. #include "flyaway.h"  // This gets the definition of the types 
  13.                       //       "word" and "items_on_hand"
  14.  
  15. #include "items.hpp"  // This gets the definition of the item list
  16.  
  17. class location {
  18.    location *north_move;      // Where we go to, north of here
  19.    location *east_move;       // Where we go to, east of here
  20.    location *south_move;      // Where we go to, south of here
  21.    location *west_move;       // Where we go to, west of here
  22.    char *message;             // Message output when we enter here
  23.    char *look_message;        // The message output for a "look"
  24.    items list_of_items;       // The list of items in this location
  25. public:
  26.    void init(location *valid_north,  // These four directions are
  27.          location *valid_east,   //   initialized when init
  28.          location *valid_south,  //   is called.
  29.          location *valid_west,
  30.          char *local_message,
  31.          char *local_look_message);
  32.    location *move(word direction);   // Move to another location
  33.    void add_item(word item_to_add);  // This puts an item here
  34.    void drop_item(word item_to_drop);// Item picked up by player
  35.    char item_here(word item_to_check);// Is this item here?
  36.    void display_message(void);       // This displays the message
  37.    void display_list_of_items(void); // Display items found here
  38.                                      //  and a few room details.
  39. };
  40.  
  41. #endif
  42.  
  43.